/*
using MyGeneration/Template/NHibernate (c) by Sharp 1.4
based on OHM (alvy77@hotmail.com)
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace DomainModel
{

	/// <summary>
	/// ILibraryBook interface for NHibernate mapped table 'LibraryBook'.
	/// </summary>
	public interface ILibraryBook
	{
		#region Public Properties
		
		int lb_id
		{
			get ;
			set ;
			  
		}
		
		string lb_bookName
		{
			get ;
			set ;
			  
		}
		
		string lb_translatedName
		{
			get ;
			set ;
			  
		}
		
		byte lb_language
		{
			get ;
			set ;
			  
		}
		
		byte lb_ebook
		{
			get ;
			set ;
			  
		}
		
		byte lb_forAge
		{
			get ;
			set ;
			  
		}
		
		byte lb_level
		{
			get ;
			set ;
			  
		}
		
		byte lb_bookType
		{
			get ;
			set ;
			  
		}
		
		byte lb_bookTheme
		{
			get ;
			set ;
			  
		}
		
		string lb_author
		{
			get ;
			set ;
			  
		}
		
		string lb_press
		{
			get ;
			set ;
			  
		}
		
		DateTime lb_time
		{
			get ;
			set ;
			  
		}
		
		int lb_pageSize
		{
			get ;
			set ;
			  
		}
		
		byte? lb_kb
		{
			get ;
			set ;
			  
		}
		
		string lb_paper
		{
			get ;
			set ;
			  
		}
		
		string lb_bz
		{
			get ;
			set ;
			  
		}
		
		decimal lb_price
		{
			get ;
			set ;
			  
		}
		
		string lb_aboutEbook
		{
			get ;
			set ;
			  
		}
		
		byte lb_aboutCd
		{
			get ;
			set ;
			  
		}
		
		string lb_aboutMp3
		{
			get ;
			set ;
			  
		}
		
		string lb_bookContent
		{
			get ;
			set ;
			  
		}
		
		string lb_bookPreview
		{
			get ;
			set ;
			  
		}
		
		string lb_cover
		{
			get ;
			set ;
			  
		}
		
		string lb_position
		{
			get ;
			set ;
			  
		}
		
		int lb_inventory
		{
			get ;
			set ;
			  
		}
		
		byte lb_state
		{
			get ;
			set ;
			  
		}
		
		int lb_user
		{
			get ;
			set ;
			  
		}
		
		DateTime lb_addTime
		{
			get ;
			set ;
			  
		}
		
		int? lb_lastUser
		{
			get ;
			set ;
			  
		}
		
		DateTime? lb_updateTime
		{
			get ;
			set ;
			  
		}
		
		int lb_booksCount
		{
			get ;
			set ;
			  
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
	}

	/// <summary>
	/// LibraryBook object for NHibernate mapped table 'LibraryBook'.
	/// </summary>
	[Serializable]
	public class LibraryBook : ICloneable,ILibraryBook
	{
		#region Member Variables

		protected int _lb_id;
		protected string _lb_bookname;
		protected string _lb_translatedname;
		protected byte _lb_language;
		protected byte _lb_ebook;
		protected byte _lb_forage;
		protected byte _lb_level;
		protected byte _lb_booktype;
		protected byte _lb_booktheme;
		protected string _lb_author;
		protected string _lb_press;
		protected DateTime _lb_time;
		protected int _lb_pagesize;
		protected byte? _lb_kb;
		protected string _lb_paper;
		protected string _lb_bz;
		protected decimal _lb_price;
		protected string _lb_aboutebook;
		protected byte _lb_aboutcd;
		protected string _lb_aboutmp3;
		protected string _lb_bookcontent;
		protected string _lb_bookpreview;
		protected string _lb_cover;
		protected string _lb_position;
		protected int _lb_inventory;
		protected byte _lb_state;
		protected int _lb_user;
		protected DateTime _lb_addtime;
		protected int? _lb_lastuser;
		protected DateTime? _lb_updatetime;
		protected int _lb_bookscount;
		protected bool _bIsDeleted;
		protected bool _bIsChanged;
		#endregion
		
		#region Constructors
		public LibraryBook() {}
		
		public LibraryBook(string plbbookName, string plbtranslatedName, byte plblanguage, byte plbebook, byte plbforAge, byte plblevel, byte plbbookType, byte plbbookTheme, string plbauthor, string plbpress, DateTime plbtime, int plbpageSize, byte? plbkb, string plbpaper, string plbbz, decimal plbprice, string plbaboutEbook, byte plbaboutCd, string plbaboutMp3, string plbbookContent, string plbbookPreview, string plbcover, string plbposition, int plbinventory, byte plbstate, int plbuser, DateTime plbaddTime, int? plblastUser, DateTime? plbupdateTime, int plbbooksCount)
		{
			this._lb_bookname = plbbookName; 
			this._lb_translatedname = plbtranslatedName; 
			this._lb_language = plblanguage; 
			this._lb_ebook = plbebook; 
			this._lb_forage = plbforAge; 
			this._lb_level = plblevel; 
			this._lb_booktype = plbbookType; 
			this._lb_booktheme = plbbookTheme; 
			this._lb_author = plbauthor; 
			this._lb_press = plbpress; 
			this._lb_time = plbtime; 
			this._lb_pagesize = plbpageSize; 
			this._lb_kb = plbkb; 
			this._lb_paper = plbpaper; 
			this._lb_bz = plbbz; 
			this._lb_price = plbprice; 
			this._lb_aboutebook = plbaboutEbook; 
			this._lb_aboutcd = plbaboutCd; 
			this._lb_aboutmp3 = plbaboutMp3; 
			this._lb_bookcontent = plbbookContent; 
			this._lb_bookpreview = plbbookPreview; 
			this._lb_cover = plbcover; 
			this._lb_position = plbposition; 
			this._lb_inventory = plbinventory; 
			this._lb_state = plbstate; 
			this._lb_user = plbuser; 
			this._lb_addtime = plbaddTime; 
			this._lb_lastuser = plblastUser; 
			this._lb_updatetime = plbupdateTime; 
			this._lb_bookscount = plbbooksCount; 
		}
		
		public LibraryBook(string plbbookName, byte plblanguage, byte plbebook, byte plbforAge, byte plblevel, byte plbbookType, byte plbbookTheme, string plbauthor, string plbpress, DateTime plbtime, int plbpageSize, string plbpaper, string plbbz, decimal plbprice, byte plbaboutCd, string plbbookContent, string plbbookPreview, string plbcover, int plbinventory, byte plbstate, int plbuser, DateTime plbaddTime, int plbbooksCount)
		{
			this._lb_bookname = plbbookName; 
			this._lb_language = plblanguage; 
			this._lb_ebook = plbebook; 
			this._lb_forage = plbforAge; 
			this._lb_level = plblevel; 
			this._lb_booktype = plbbookType; 
			this._lb_booktheme = plbbookTheme; 
			this._lb_author = plbauthor; 
			this._lb_press = plbpress; 
			this._lb_time = plbtime; 
			this._lb_pagesize = plbpageSize; 
			this._lb_paper = plbpaper; 
			this._lb_bz = plbbz; 
			this._lb_price = plbprice; 
			this._lb_aboutcd = plbaboutCd; 
			this._lb_bookcontent = plbbookContent; 
			this._lb_bookpreview = plbbookPreview; 
			this._lb_cover = plbcover; 
			this._lb_inventory = plbinventory; 
			this._lb_state = plbstate; 
			this._lb_user = plbuser; 
			this._lb_addtime = plbaddTime; 
			this._lb_bookscount = plbbooksCount; 
		}
		
		public LibraryBook(int plbid)
		{
			this._lb_id = plbid; 
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual int lb_id
		{
			get { return _lb_id; }
			set { _bIsChanged |= (_lb_id != value); _lb_id = value; }
			
		}
		
		public virtual string lb_bookName
		{
			get { return _lb_bookname; }
			set 
			{
			  if (value != null && value.Length > 100)
			    throw new ArgumentOutOfRangeException("lb_bookName", "lb_bookName value, cannot contain more than 100 characters");
			  _bIsChanged |= (_lb_bookname != value); 
			  _lb_bookname = value; 
			}
			
		}
		
		public virtual string lb_translatedName
		{
			get { return _lb_translatedname; }
			set 
			{
			  if (value != null && value.Length > 100)
			    throw new ArgumentOutOfRangeException("lb_translatedName", "lb_translatedName value, cannot contain more than 100 characters");
			  _bIsChanged |= (_lb_translatedname != value); 
			  _lb_translatedname = value; 
			}
			
		}
		
		public virtual byte lb_language
		{
			get { return _lb_language; }
			set { _bIsChanged |= (_lb_language != value); _lb_language = value; }
			
		}
		
		public virtual byte lb_ebook
		{
			get { return _lb_ebook; }
			set { _bIsChanged |= (_lb_ebook != value); _lb_ebook = value; }
			
		}
		
		public virtual byte lb_forAge
		{
			get { return _lb_forage; }
			set { _bIsChanged |= (_lb_forage != value); _lb_forage = value; }
			
		}
		
		public virtual byte lb_level
		{
			get { return _lb_level; }
			set { _bIsChanged |= (_lb_level != value); _lb_level = value; }
			
		}
		
		public virtual byte lb_bookType
		{
			get { return _lb_booktype; }
			set { _bIsChanged |= (_lb_booktype != value); _lb_booktype = value; }
			
		}
		
		public virtual byte lb_bookTheme
		{
			get { return _lb_booktheme; }
			set { _bIsChanged |= (_lb_booktheme != value); _lb_booktheme = value; }
			
		}
		
		public virtual string lb_author
		{
			get { return _lb_author; }
			set 
			{
			  if (value != null && value.Length > 60)
			    throw new ArgumentOutOfRangeException("lb_author", "lb_author value, cannot contain more than 60 characters");
			  _bIsChanged |= (_lb_author != value); 
			  _lb_author = value; 
			}
			
		}
		
		public virtual string lb_press
		{
			get { return _lb_press; }
			set 
			{
			  if (value != null && value.Length > 100)
			    throw new ArgumentOutOfRangeException("lb_press", "lb_press value, cannot contain more than 100 characters");
			  _bIsChanged |= (_lb_press != value); 
			  _lb_press = value; 
			}
			
		}
		
		public virtual DateTime lb_time
		{
			get { return _lb_time; }
			set { _bIsChanged |= (_lb_time != value); _lb_time = value; }
			
		}
		
		public virtual int lb_pageSize
		{
			get { return _lb_pagesize; }
			set { _bIsChanged |= (_lb_pagesize != value); _lb_pagesize = value; }
			
		}
		
		public virtual byte? lb_kb
		{
			get { return _lb_kb; }
			set { _bIsChanged |= (_lb_kb != value); _lb_kb = value; }
			
		}
		
		public virtual string lb_paper
		{
			get { return _lb_paper; }
			set 
			{
			  if (value != null && value.Length > 100)
			    throw new ArgumentOutOfRangeException("lb_paper", "lb_paper value, cannot contain more than 100 characters");
			  _bIsChanged |= (_lb_paper != value); 
			  _lb_paper = value; 
			}
			
		}
		
		public virtual string lb_bz
		{
			get { return _lb_bz; }
			set 
			{
			  if (value != null && value.Length > 100)
			    throw new ArgumentOutOfRangeException("lb_bz", "lb_bz value, cannot contain more than 100 characters");
			  _bIsChanged |= (_lb_bz != value); 
			  _lb_bz = value; 
			}
			
		}
		
		public virtual decimal lb_price
		{
			get { return _lb_price; }
			set { _bIsChanged |= (_lb_price != value); _lb_price = value; }
			
		}
		
		public virtual string lb_aboutEbook
		{
			get { return _lb_aboutebook; }
			set 
			{
			  if (value != null && value.Length > 200)
			    throw new ArgumentOutOfRangeException("lb_aboutEbook", "lb_aboutEbook value, cannot contain more than 200 characters");
			  _bIsChanged |= (_lb_aboutebook != value); 
			  _lb_aboutebook = value; 
			}
			
		}
		
		public virtual byte lb_aboutCd
		{
			get { return _lb_aboutcd; }
			set { _bIsChanged |= (_lb_aboutcd != value); _lb_aboutcd = value; }
			
		}
		
		public virtual string lb_aboutMp3
		{
			get { return _lb_aboutmp3; }
			set 
			{
			  if (value != null && value.Length > 200)
			    throw new ArgumentOutOfRangeException("lb_aboutMp3", "lb_aboutMp3 value, cannot contain more than 200 characters");
			  _bIsChanged |= (_lb_aboutmp3 != value); 
			  _lb_aboutmp3 = value; 
			}
			
		}
		
		public virtual string lb_bookContent
		{
			get { return _lb_bookcontent; }
			set 
			{
			  if (value != null && value.Length > 2147483647)
			    throw new ArgumentOutOfRangeException("lb_bookContent", "lb_bookContent value, cannot contain more than 2147483647 characters");
			  _bIsChanged |= (_lb_bookcontent != value); 
			  _lb_bookcontent = value; 
			}
			
		}
		
		public virtual string lb_bookPreview
		{
			get { return _lb_bookpreview; }
			set 
			{
			  if (value != null && value.Length > 2147483647)
			    throw new ArgumentOutOfRangeException("lb_bookPreview", "lb_bookPreview value, cannot contain more than 2147483647 characters");
			  _bIsChanged |= (_lb_bookpreview != value); 
			  _lb_bookpreview = value; 
			}
			
		}
		
		public virtual string lb_cover
		{
			get { return _lb_cover; }
			set 
			{
			  if (value != null && value.Length > 200)
			    throw new ArgumentOutOfRangeException("lb_cover", "lb_cover value, cannot contain more than 200 characters");
			  _bIsChanged |= (_lb_cover != value); 
			  _lb_cover = value; 
			}
			
		}
		
		public virtual string lb_position
		{
			get { return _lb_position; }
			set 
			{
			  if (value != null && value.Length > 100)
			    throw new ArgumentOutOfRangeException("lb_position", "lb_position value, cannot contain more than 100 characters");
			  _bIsChanged |= (_lb_position != value); 
			  _lb_position = value; 
			}
			
		}
		
		public virtual int lb_inventory
		{
			get { return _lb_inventory; }
			set { _bIsChanged |= (_lb_inventory != value); _lb_inventory = value; }
			
		}
		
		public virtual byte lb_state
		{
			get { return _lb_state; }
			set { _bIsChanged |= (_lb_state != value); _lb_state = value; }
			
		}
		
		public virtual int lb_user
		{
			get { return _lb_user; }
			set { _bIsChanged |= (_lb_user != value); _lb_user = value; }
			
		}
		
		public virtual DateTime lb_addTime
		{
			get { return _lb_addtime; }
			set { _bIsChanged |= (_lb_addtime != value); _lb_addtime = value; }
			
		}
		
		public virtual int? lb_lastUser
		{
			get { return _lb_lastuser; }
			set { _bIsChanged |= (_lb_lastuser != value); _lb_lastuser = value; }
			
		}
		
		public virtual DateTime? lb_updateTime
		{
			get { return _lb_updatetime; }
			set { _bIsChanged |= (_lb_updatetime != value); _lb_updatetime = value; }
			
		}
		
		public virtual int lb_booksCount
		{
			get { return _lb_bookscount; }
			set { _bIsChanged |= (_lb_bookscount != value); _lb_bookscount = value; }
			
		}
		

		public virtual bool IsDeleted
		{
			get
			{
				return _bIsDeleted;
			}
			set
			{
				_bIsDeleted = value;
			}
		}
		
		public virtual bool IsChanged
		{
			get
			{
				return _bIsChanged;
			}
			set
			{
				_bIsChanged = value;
			}
		}
		
		#endregion 
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			LibraryBook castObj = null;
			try
			{
				castObj = (LibraryBook)obj;
			} catch(Exception) { return false; } 
			return ( castObj != null ) &&
				( this._lb_id == castObj.lb_id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _lb_id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region ICloneable methods
		
		public virtual object Clone()
		{
			return this.MemberwiseClone();
		}
		
		#endregion
	}
	
	#region Custom ICollection interface for LibraryBook 

	
	public interface ILibraryBookCollection : ICollection
	{
		LibraryBook this[int index]{	get; set; }
		void Add(LibraryBook pLibraryBook);
		void Clear();
	}
	
	[Serializable]
	public class LibraryBookCollection : ILibraryBookCollection
	{
		private IList<LibraryBook> _arrayInternal;

		public LibraryBookCollection()
		{
			_arrayInternal = new List<LibraryBook>();
		}
		
		public LibraryBookCollection( IList<LibraryBook> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<LibraryBook>();
			}
		}

		public LibraryBook this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((LibraryBook[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(LibraryBook pLibraryBook) { _arrayInternal.Add(pLibraryBook); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<LibraryBook> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
